package day5;

import java.util.Scanner;

/**
 * @author oldliu
 * @since 1.0
 */
public class SearchArray {
    public static void main(String[] args) {
        int[] ar = {8, 5, 3, 12, 14, 22, 556, 159, 6, 9};
        Scanner in = new Scanner(System.in);
        System.out.print("要查找的数字：");
        int k = in.nextInt();
        boolean exist = false;//假定不在
        for (int i = 0; i < ar.length; i++) {
            if (ar[i] == k) {
                System.out.println(k + "在数组中");
                exist = true;
                break;
            }
        }
        if (!exist) {
            System.out.println(k + "不在数组中");
        }
    }
}
